Answer:

  1. The int value in answer is transformed into chars (and appended to the string).
  2. Then, as the data is written to disk, the chars are transformed into 8-bit UTF.

Summary of Class FileWriter

Here is a list of some of the constructors and methods used with FileWriter. All of the methods are inherited from its ancestors. For a complete list of methods refer to the Java documentation on your disk (if you downloaded it) or on the Web.

Constructors

FileWriter(String fileName) 
   An IOException is thrown 
   if the file cannot be created.
            
FileWriter(String fileName, boolean append)            
   An IOException is thrown 
   if the file cannot be opened for appending.

Methods

public void close() throws IOException
    Flush the stream and close the file.

public void flush() throws IOException
    Flush the stream.

public void write(String str) throws IOException
    Write a string.

Data might not go immediately to the disk after a write(). The flush() method ensures that data previously written is sent to the disk.

QUESTION 11:

Could the user of a program enter a name for the file about to be created?